<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/jquery/jquery.min.js"></script>
    <script src="vue/vue.js"></script>
    <script src="js/plugins/js-cookie/js.cookie.min.js"></script>
    <script src="js/plugins/jquery-form/jquery.form.js"></script>
</head>
<body>
    <form method="get">
        url:<input type="text" id="url"  size="15" style="width:300px;height:20px;">
        <input id="searchBut" type="button" value="查询"><br/>
        <span id="text"></span>
    </form>
</body>
    <script>
        $('#searchBut').click(function () {
            var url = $('#url').val();
            var token= Cookies.get('token');
            token = token ? token : "";
            console.log(url);
           /* $.get("/getContent", {"url":url},function (data) {
                if (data.success){
                    document.getElementById('text').innerHTML = data.data;
                }
            });*/
            $.ajax({
                type: "GET",
                url: "/getContent",
                data: {"url":url},
                dataType: 'json',
                beforeSend:function(xhr){
                    xhr.setRequestHeader("token",token);
                },
                success:function (data) {
                    if(data.success){
                        document.getElementById('text').innerHTML = data.data;
                    }
                },
                error:function () {
                    console.log("网络异常,请联系管理员")
                }
            });

           /* $.ajax({
                type: "GET",
                url: "/getContent",
                data:{url:url},
                beforeSend:function(xhr){
                    xhr.setRequestHeader("token",token);
                },
                success: function(data) {
                    if(data.success){
                        document.getElementById('text').innerHTML = data.data;
                    };
                }
            });*/
        })
    </script>
</html>